#include "contact.pb.h"
using namespace std;
int main()
{
    string people_str;
    contact::PersonInit p1;
    p1.set_age(100);
    p1.set_name("张三");
    p1.set_sex("boy");

//     contact::Phone().set_phone(1,"111");
//     contact::PersonInit::Address a1;

//    a1.set_address(1,"sanya");
   
    if (!p1.SerializeToString(&people_str)) 
    {
        cout << "序列化联系人失败." << endl;
    }
    // 打印序列化结果
    cout << "序列化后的 people_str: " << people_str << endl;
    
    if(!p1.SerializePartialToString(&people_str))
    {
        cout<<"反序列化失败:"<<endl;
    }
    cout<<"反序列化成功:"<<endl<<people_str<<endl;
    return 0;
}